#include "Log.h"
#include "TimeFunc.h"

string MakeRequestLogMessage(string ip, queue<Request *> requests)
{
    int size = requests.size();
    Request * req;
    string output("");
    for(int i = 0; i < size; i++)
    {
        req = requests.front();
        requests.pop();
        output += ip + " sent request: " + (*req).GetMethod() + " " + (*req).GetUri();
        output += " at: " + DateTimeNow() + "\n";
        requests.push(req);
    }
    return output;
}
string MakeResponseLogMessage(string ip, Response resp)
{
    string output("");
    output += ip + " received response: " + resp.method + " " + resp.fileName;
    output +=  " " + resp.statusCode + " at: " + DateTimeNow() + "\n";
    return output;
}
string MakeConnectMessage(string ip)
{
    string output("");
    output += "IP address " + ip + " connected at: " + DateTimeNow() + "\n";
    return output;
}
string MakeDisconnectMessage(string ip)
{
    string output("");
    output += "IP address " + ip + " disconnected at: " + DateTimeNow() + "\n";
    return output;
}